package mm.card.dao.model;

import java.math.BigDecimal;
import java.util.Date;

import mm.card.util.AesUtil;
import mm.card.util.BigDecimalUtil;
import mm.card.util.DateUtil;

public class CardOrderInfo {

	public CardOrderInfo() {
	}

	public CardOrderInfo(CardTable4 tb) throws Exception {
		this.id = tb.getId();
		this.orderId = AesUtil.decrypt(tb.getAttribute1());
		this.orderMoney = new BigDecimal(AesUtil.decrypt(tb.getAttribute2()));
		this.rate = new BigDecimal(AesUtil.decrypt(tb.getAttribute3()));
		this.shopId = AesUtil.decrypt(tb.getAttribute4());
		this.shopName = AesUtil.decrypt(tb.getAttribute5());
		this.shopMoney = new BigDecimal(AesUtil.decrypt(tb.getAttribute6()));
		this.qrcodeId = AesUtil.decrypt(tb.getAttribute7());
		this.bank = AesUtil.decrypt(tb.getAttribute8());
		this.bankCode = AesUtil.decrypt(tb.getAttribute9());
		this.bankCard = AesUtil.decrypt(tb.getAttribute10());
		this.address = AesUtil.decrypt(tb.getAttribute11());
		this.createTime = DateUtil.str2DateTime(AesUtil.decrypt(tb.getAttribute12()));
		this.payTime = DateUtil.str2DateTime(AesUtil.decrypt(tb.getAttribute13()));
		this.payStatus = Integer.valueOf(AesUtil.decrypt(tb.getAttribute14()));
		this.isDelete = Integer.valueOf(AesUtil.decrypt(tb.getAttribute15()));
	}

	public CardTable4 toCardTable4() throws Exception {
		CardTable4 tb = new CardTable4();
		tb.setId(this.id);
		tb.setAttribute1(AesUtil.encrypt(this.orderId));
		tb.setAttribute2(AesUtil.encrypt(BigDecimalUtil.millionthFormat(this.orderMoney)));
		tb.setAttribute3(AesUtil.encrypt(BigDecimalUtil.millionthFormat(this.rate)));
		tb.setAttribute4(AesUtil.encrypt(this.shopId));
		tb.setAttribute5(AesUtil.encrypt(this.shopName));
		tb.setAttribute6(AesUtil.encrypt(BigDecimalUtil.millionthFormat(this.shopMoney)));
		tb.setAttribute7(AesUtil.encrypt(this.qrcodeId));
		tb.setAttribute8(AesUtil.encrypt(this.bank));
		tb.setAttribute9(AesUtil.encrypt(this.bankCode));
		tb.setAttribute10(AesUtil.encrypt(this.bankCard));
		tb.setAttribute11(AesUtil.encrypt(this.address));
		tb.setAttribute12(AesUtil.encrypt(DateUtil.dateTime2Str(this.createTime)));
		tb.setAttribute13(AesUtil.encrypt(DateUtil.dateTime2Str(this.payTime)));
		tb.setAttribute14(AesUtil.encrypt(this.payStatus.toString()));
		tb.setAttribute15(AesUtil.encrypt(this.isDelete.toString()));
		return tb;
	}

	/**
	 * This field was generated by MyBatis Generator. This field corresponds to
	 * the database column card_order_info.id
	 *
	 * @mbggenerated
	 */
	private Long id;

	/**
	 * 订单ID
	 *
	 * @mbggenerated
	 */
	private String orderId;

	/**
	 * 订单总金额
	 *
	 * @mbggenerated
	 */
	private BigDecimal orderMoney;

	/**
	 * 总抽成费率。shop_money=order_money*(1-rate)
	 *
	 * @mbggenerated
	 */
	private BigDecimal rate;

	/**
	 * 商铺ID
	 *
	 * @mbggenerated
	 */
	private String shopId;

	/**
	 * 商铺名称
	 *
	 * @mbggenerated
	 */
	private String shopName;

	/**
	 * 商铺获得的金额
	 *
	 * @mbggenerated
	 */
	private BigDecimal shopMoney;

	/**
	 * 二维码ID
	 *
	 * @mbggenerated
	 */
	private String qrcodeId;

	/**
	 * 商铺开户银行
	 *
	 * @mbggenerated
	 */
	private String bank;

	/**
	 * 商铺开户银行编码
	 *
	 * @mbggenerated
	 */
	private String bankCode;

	/**
	 * 开户银行卡号
	 *
	 * @mbggenerated
	 */
	private String bankCard;

	/**
	 * 商铺地址
	 *
	 * @mbggenerated
	 */
	private String address;

	/**
	 * 订单创建时间
	 *
	 * @mbggenerated
	 */
	private Date createTime;

	/**
	 * 支付时间
	 *
	 * @mbggenerated
	 */
	private Date payTime;

	/**
	 * 支付状态
	 *
	 * @mbggenerated
	 */
	private Integer payStatus;

	/**
	 * 是否删除
	 *
	 * @mbggenerated
	 */
	private Integer isDelete;

	/**
	 * 获取
	 *
	 * @return id
	 *
	 * @mbggenerated
	 */
	public Long getId() {
		return id;
	}

	/**
	 * 设置
	 *
	 * @param id
	 *
	 * @mbggenerated
	 */
	public void setId(Long id) {
		this.id = id;
	}

	/**
	 * 获取订单ID
	 *
	 * @return orderId 订单ID
	 *
	 * @mbggenerated
	 */
	public String getOrderId() {
		return orderId;
	}

	/**
	 * 设置订单ID
	 *
	 * @param orderId
	 *            订单ID
	 *
	 * @mbggenerated
	 */
	public void setOrderId(String orderId) {
		this.orderId = orderId == null ? null : orderId.trim();
	}

	/**
	 * 获取订单总金额
	 *
	 * @return orderMoney 订单总金额
	 *
	 * @mbggenerated
	 */
	public BigDecimal getOrderMoney() {
		return orderMoney;
	}

	/**
	 * 设置订单总金额
	 *
	 * @param orderMoney
	 *            订单总金额
	 *
	 * @mbggenerated
	 */
	public void setOrderMoney(BigDecimal orderMoney) {
		this.orderMoney = orderMoney;
	}

	/**
	 * 获取总抽成费率。shop_money=order_money*(1-rate)
	 *
	 * @return rate 总抽成费率。shop_money=order_money*(1-rate)
	 *
	 * @mbggenerated
	 */
	public BigDecimal getRate() {
		return rate;
	}

	/**
	 * 设置总抽成费率。shop_money=order_money*(1-rate)
	 *
	 * @param rate
	 *            总抽成费率。shop_money=order_money*(1-rate)
	 *
	 * @mbggenerated
	 */
	public void setRate(BigDecimal rate) {
		this.rate = rate;
	}

	/**
	 * 获取商铺ID
	 *
	 * @return shopId 商铺ID
	 *
	 * @mbggenerated
	 */
	public String getShopId() {
		return shopId;
	}

	/**
	 * 设置商铺ID
	 *
	 * @param shopId
	 *            商铺ID
	 *
	 * @mbggenerated
	 */
	public void setShopId(String shopId) {
		this.shopId = shopId == null ? null : shopId.trim();
	}

	/**
	 * 获取商铺名称
	 *
	 * @return shopName 商铺名称
	 *
	 * @mbggenerated
	 */
	public String getShopName() {
		return shopName;
	}

	/**
	 * 设置商铺名称
	 *
	 * @param shopName
	 *            商铺名称
	 *
	 * @mbggenerated
	 */
	public void setShopName(String shopName) {
		this.shopName = shopName == null ? null : shopName.trim();
	}

	/**
	 * 获取商铺获得的金额
	 *
	 * @return shopMoney 商铺获得的金额
	 *
	 * @mbggenerated
	 */
	public BigDecimal getShopMoney() {
		return shopMoney;
	}

	/**
	 * 设置商铺获得的金额
	 *
	 * @param shopMoney
	 *            商铺获得的金额
	 *
	 * @mbggenerated
	 */
	public void setShopMoney(BigDecimal shopMoney) {
		this.shopMoney = shopMoney;
	}

	/**
	 * 获取二维码ID
	 *
	 * @return qrcodeId 二维码ID
	 *
	 * @mbggenerated
	 */
	public String getQrcodeId() {
		return qrcodeId;
	}

	/**
	 * 设置二维码ID
	 *
	 * @param qrcodeId
	 *            二维码ID
	 *
	 * @mbggenerated
	 */
	public void setQrcodeId(String qrcodeId) {
		this.qrcodeId = qrcodeId == null ? null : qrcodeId.trim();
	}

	/**
	 * 获取商铺开户银行
	 *
	 * @return bank 商铺开户银行
	 *
	 * @mbggenerated
	 */
	public String getBank() {
		return bank;
	}

	/**
	 * 设置商铺开户银行
	 *
	 * @param bank
	 *            商铺开户银行
	 *
	 * @mbggenerated
	 */
	public void setBank(String bank) {
		this.bank = bank == null ? null : bank.trim();
	}

	/**
	 * 获取商铺开户银行编码
	 *
	 * @return bankCode 商铺开户银行编码
	 *
	 * @mbggenerated
	 */
	public String getBankCode() {
		return bankCode;
	}

	/**
	 * 设置商铺开户银行编码
	 *
	 * @param bankCode
	 *            商铺开户银行编码
	 *
	 * @mbggenerated
	 */
	public void setBankCode(String bankCode) {
		this.bankCode = bankCode == null ? null : bankCode.trim();
	}

	/**
	 * 获取开户银行卡号
	 *
	 * @return bankCard 开户银行卡号
	 *
	 * @mbggenerated
	 */
	public String getBankCard() {
		return bankCard;
	}

	/**
	 * 设置开户银行卡号
	 *
	 * @param bankCard
	 *            开户银行卡号
	 *
	 * @mbggenerated
	 */
	public void setBankCard(String bankCard) {
		this.bankCard = bankCard == null ? null : bankCard.trim();
	}

	/**
	 * 获取商铺地址
	 *
	 * @return address 商铺地址
	 *
	 * @mbggenerated
	 */
	public String getAddress() {
		return address;
	}

	/**
	 * 设置商铺地址
	 *
	 * @param address
	 *            商铺地址
	 *
	 * @mbggenerated
	 */
	public void setAddress(String address) {
		this.address = address == null ? null : address.trim();
	}

	/**
	 * 获取订单创建时间
	 *
	 * @return createTime 订单创建时间
	 *
	 * @mbggenerated
	 */
	public Date getCreateTime() {
		return createTime;
	}

	/**
	 * 设置订单创建时间
	 *
	 * @param createTime
	 *            订单创建时间
	 *
	 * @mbggenerated
	 */
	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	/**
	 * 获取支付时间
	 *
	 * @return payTime 支付时间
	 *
	 * @mbggenerated
	 */
	public Date getPayTime() {
		return payTime;
	}

	/**
	 * 设置支付时间
	 *
	 * @param payTime
	 *            支付时间
	 *
	 * @mbggenerated
	 */
	public void setPayTime(Date payTime) {
		this.payTime = payTime;
	}

	/**
	 * 获取支付状态
	 *
	 * @return payStatus 支付状态
	 *
	 * @mbggenerated
	 */
	public Integer getPayStatus() {
		return payStatus;
	}

	/**
	 * 设置支付状态
	 *
	 * @param payStatus
	 *            支付状态
	 *
	 * @mbggenerated
	 */
	public void setPayStatus(Integer payStatus) {
		this.payStatus = payStatus;
	}

	/**
	 * 获取是否删除
	 *
	 * @return isDelete 是否删除
	 *
	 * @mbggenerated
	 */
	public Integer getIsDelete() {
		return isDelete;
	}

	/**
	 * 设置是否删除
	 *
	 * @param isDelete
	 *            是否删除
	 *
	 * @mbggenerated
	 */
	public void setIsDelete(Integer isDelete) {
		this.isDelete = isDelete;
	}
}